import { getClassData } from "../../utils/api";

const ClassModule = {
  state: {
    res: null,
    res2: null,
  },
  mutations: {
    // 推荐
    getClass(state, playload) {
      state.res = playload;
      //去两条数据
    },
    getClass2(state, playload) {
      state.res2 = playload;
      //去两条数据
    },

    // },
  },
  actions: {
    async getClassAsync({ commit }) {
      const res = await getClassData();

      const res2 = res.data.result[0].one.slice(0, 2);

      commit("getClass", res2);
    },
    async getClass2Async({ commit }) {
      const res = await getClassData();
      // console.log(res.data.result[1].two);
      commit("getClass2", res.data.result[1].two);
    },
  },
};

export default ClassModule;
